package edu.stu.mall.activity.login

import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import edu.mall.base.BaseActivity
import edu.stu.mall.BR
import edu.stu.mall.MyApplication.Companion.context
import edu.stu.mall.R
import edu.stu.mall.activity.recommended.ProductDetailActivity
import edu.stu.mall.activity.tab.TabActivity
import edu.stu.mall.databinding.ActivityLoginBinding

class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
    override fun getLayoutId(): Int = R.layout.activity_login
    override fun getViewModelId(): Int = BR.loginVm

    override fun initViewData() {
        binding?.btnLogin?.setOnClickListener {

            viewModel?.loginData?.observe(this) {
                // 处理登录数据变化
                // 例如更新UI或执行其他逻辑

                Log.e("TAG", "activity: ${it?.token}", )
                val intent = Intent(context, TabActivity::class.java)
//                val bundle = Bundle()
//                bundle.putString("id", item.id.toString()) // 这里可以是任何String值
//                intent.putExtras(bundle)
                startActivity(intent)
            }
        }

    }
}
